home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GNUGEM27 / AESFORMS.C < prev    next >
C/C++ Source or Header  |  1993-03-24  |  6KB  |  218 lines

  1. /*
  2.  *    Aes forms library interface
  3.  *
  4.  *        form_do   monitor user interaction with a dialog.
  5.  *        form_dial      Reserve/Free screen space, draw expand/shrink ing
  6.  *              outline of dialog.
  7.  *        form_alert      Display an Alert.
  8.  *        form_error      Display an error.
  9.  *        form_center   Center a dialog.
  10.  *
  11.  *        ++jrb    bammi@cadence.com
  12.  *        modified: mj -- ntomczak@vm.ucs.ualberta.ca
  13.  */
  14. #include "common.h"
  15.  
  16. /* Monitor User interaction with form
  17.  *    returns index of object that caused the end of interaction
  18.  */
  19.  
  20. #ifdef __DEF_ALL__
  21.  
  22. #define L_form_do
  23. #define L_form_dia
  24. #define L_form_ale
  25. #define L_form_err
  26. #define L_form_cen
  27. #define L_form_key
  28. #define L_form_but
  29.  
  30. #endif /* __DEF_ALL__ */
  31.  
  32.  
  33. #ifdef L_form_do
  34.  
  35. int form_do(void *Tree,     /* address of root of Object tree  */
  36.         int StartObj)    /* index of an editable text field */
  37.                 /* where cursor is placed           */
  38.                 /* =0 if no such field           */
  39. {
  40.     _int_in[0] = StartObj;
  41.     _addrin[0] = Tree;
  42.     return __aes__(AES_CONTROL_ENCODE(50, 1, 1, 1));
  43. }
  44. #endif /* L_form_do */
  45.  
  46. #ifdef L_form_dia
  47.  
  48. /* Form Dialog
  49.  *    Depending on the Value of Flag do
  50.  *    Flag = 0 (FMD_START)
  51.  *        Reserve Space for Dialog Box.
  52.  *    Flag = 1 (FMD_GROW)
  53.  *        Draw a growing box from S to B.
  54.  *    Flag = 2 (FMD_SHRINK)
  55.  *        Draw a shrinking box from B to S.
  56.  *    Flag = 3 (FMD_FINISH)
  57.  *        Free scren space claimed by FMD_START.
  58.  *
  59.  *    returns == 0 an error exists, >0 no error.
  60.  */
  61. int form_dial(int Flag,
  62.           int Sx, int Sy, int Sw, int Sh, /* smallest size */
  63.           int Bx, int By, int Bw, int Bh) /* largest  size */
  64. {
  65.     _int_in[0] = Flag;
  66.     _int_in[1] = Sx;
  67.     _int_in[2] = Sy;
  68.     _int_in[3] = Sw;
  69.     _int_in[4] = Sh;
  70.  
  71.     _int_in[5] = Bx;
  72.     _int_in[6] = By;
  73.     _int_in[7] = Bw;
  74.     _int_in[8] = Bh;
  75.  
  76.     return __aes__(AES_CONTROL_ENCODE(51, 9, 1, 0));
  77. }
  78. #endif /* L_form_dia */
  79.  
  80.  
  81. #ifdef L_form_ale
  82.  
  83. /* Display an Alert
  84.  * alert string ::= "[<icon>][<message>][<buttons>]" (braks are literal)
  85.  *    icon        ::=  0 No Icon, 1 note, 2 Wait, 3 Stop
  86.  *    message, button ::=  '|' seperated strings
  87.  *
  88.  * limits:    each alert line < 30 chars, each button < 10 chars
  89.  *
  90.  *    returns exit button
  91.  */
  92. int form_alert(int DefButton,    /* default exit button (0 if none) */
  93.            char *Str)    /* alert string */
  94. {
  95.     _int_in[0] = DefButton;
  96.     _addrin[0] = Str;
  97.     return __aes__(AES_CONTROL_ENCODE(52, 1, 1, 1));
  98. }
  99. #endif /* L_form_ale */
  100.  
  101.  
  102. #ifdef L_form_err
  103.  
  104. /* Display a error code dialog box
  105.  *    returns exit button (1, 2, or 3)
  106.  * handles only the following error codes:
  107.  * 2,3,18    cannot find folder/file
  108.  * 4        no room to open another doc
  109.  * 5        item alredy exists or is read-only
  110.  * 8,10,11    not enough mem for application
  111.  * 15        drive does not exists
  112.  *    [Ed: someone at atari is really screwed up]
  113.  */
  114. int form_error(int ErrorCode)
  115. {
  116.     _int_in[0] = ErrorCode;
  117.     return __aes__(AES_CONTROL_ENCODE(53, 1, 1, 0));
  118. }
  119. #endif /* L_form_err */
  120.  
  121.  
  122. #ifdef L_form_cen
  123.  
  124. /* Center a dialog
  125.  *    returns a reserved value
  126.  */
  127. int form_center(void *Tree, /* addr of root of dialog tree */
  128.         int *Cx, int *Cy, int *Cw, int *Ch) /* centered box */
  129. {
  130.     int retval;
  131.  
  132.     _addrin[0] = Tree;
  133.  
  134.     retval = __aes__(AES_CONTROL_ENCODE(54, 0, 5, 1));
  135.  
  136.     *Cx = _int_out[1];
  137.     *Cy = _int_out[2];
  138.     *Cw = _int_out[3];
  139.     *Ch = _int_out[4];
  140.  
  141.     return retval;
  142. }
  143. #endif /* L_form_cen */
  144.  
  145. /* Two forgotten AES calls - 55 & 56                    */
  146. /* Reference:     Atari ST Profibuch                 */
  147. /*            Hans-Dieter Jankowski, Julian F. Reschke, Dietmar Rabich */
  148. /*            SYBEX-Verlag GmbH, Dsseldorf, Germany            */
  149. /*        7.th edition 1989                    */
  150. /*        ISBN : 3-88745-563-0                    */
  151. /*        Pages 549 ff.                        */
  152.  
  153. #ifdef L_form_key
  154.  
  155. /* This one simulates keyboard input into a form. */
  156. /* Parameters :                             */
  157. /*    Ktree : Adress of the object tree                */
  158. /*    Kobject : object number of current EDIT - Object        */
  159. /*    Kobnext : unused, set to zero                    */
  160. /*    Kchar    : the character to be input into the form        */
  161. /*    *Knxtobject : new EDIT - Object for the next call        */
  162. /*        (changes if tab, cursor or return has been pressed) */
  163. /*    *Knxtchar : 0: character was cursor, tab or return        */
  164. /*            >0 : character input into the form        */
  165. /* Return value: 0: Exit - object has been pressed            */
  166. /*        >0 Dialog has not been finished yet             */
  167. int form_keybd(void *Ktree, int Kobject, int Kobnext, int Kchar,
  168.         int *Knxtobject, int *Knxtchar)
  169.  
  170. {
  171.     int retval;
  172.  
  173.     _addrin[0] = Ktree;
  174.     _int_in[0] = Kobject;
  175.     _int_in[1] = Kchar;
  176.     _int_in[2] = Kobnext;
  177.  
  178.     retval = __aes__(AES_CONTROL_ENCODE(55, 3, 3, 1));
  179.  
  180.     *Knxtobject = _int_out[1];
  181.     *Knxtchar = _int_out[2];
  182.  
  183.     return retval;
  184. }
  185. #endif /* L_form_key */
  186.  
  187. #ifdef L_form_but
  188.  
  189. /* This one simulates mouse clicks into a form. */
  190. /* Parameters :                             */
  191. /*    Btree : Adress of the object tree                */
  192. /*    Bobject : object number of object to be worked upon     */
  193. /*    Bclicks : number of mouse clicks to be simulated        */
  194. /*    Bnxtobj : new current object , high - order - bit is set if */
  195. /*        there was a double click to a TOUCHEXIT - object    */
  196. /*        0: next object is HIDDEN or DISABLED or is not        */
  197. /*        EDITABLE                        */
  198. /* Return value: 0: an EXIT - or TOUCHEXIT - object has been selected    */
  199. /*        >0 : dialog has not been finished            */
  200. int form_button(void *Btree, int Bobject, int Bclicks, int *Bnxtobj)
  201.  
  202. {
  203.     int retval;
  204.  
  205.     _addrin[0] = Btree;
  206.     _int_in[0] = Bobject;
  207.     _int_in[1] = Bclicks;
  208.  
  209.     retval = __aes__(AES_CONTROL_ENCODE(56, 2, 2, 1));
  210.  
  211.     *Bnxtobj = _int_out[1];
  212.  
  213.     return retval;
  214. }
  215. #endif /* L_form_but */
  216.  
  217. /* - eof - */
  218.